package com.souche.employment.mapper;/**
 * Created by rayinhz on 2017/9/3.
 */

import com.souche.employment.domain.FollowDO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * FollowMapper created at 2017/9/3 上午12:06
 * Ray [email:rayinhangzhou@126.com]
 * Revision History
 * Date            Programmer                   Notes
 * ----------------------------------------------------------
 **/

public interface FollowMapper {

    @Insert("insert into follow (id, employee_id, type, grade, level, interview_result, interviewer_name, interviewer_mail, creator, date_create) values(" +
            "#{id}, #{employeeId}, #{type}, #{grade}, #{level}, #{interviewResult}, #{interviewerName}, #{interviewerMail}, #{creator}, now())")
    void add(FollowDO followDO);

    @Select("select * from follow where employee_id = #{employeeId} order by date_create desc")
    @Results({
            @Result(property = "employeeId", column = "employee_id"),
            @Result(property = "interviewResult", column = "interview_result"),
            @Result(property = "interviewerName", column = "interviewer_name"),
            @Result(property = "interviewerMail", column = "interviewer_mail"),
            @Result(property = "dateCreate", column = "date_create")
    })
    List<FollowDO> getForListByEmployee(String employeeId);
}
